package com.mydroidchat.views;

import com.alee.laf.button.WebButton;
import com.alee.laf.label.WebLabel;
import com.alee.laf.text.WebPasswordField;
import com.alee.laf.text.WebTextField;
import com.jgoodies.forms.layout.CellConstraints;
import com.jgoodies.forms.layout.FormLayout;

import javax.swing.*;

public class LoginPanelView extends JPanel {

    private final WebTextField loginTextField;
    private final WebPasswordField passwordField;
    private final WebButton signInButton;
    private final WebButton exitButton;

    public LoginPanelView() {
        super(new FormLayout("fill:pref:grow, pref, 5dlu, pref, fill:pref:grow", "15dlu, pref, 2dlu, pref, 5dlu, pref"));
        CellConstraints cc = new CellConstraints();
        WebLabel loginLabel = new WebLabel("Login: ");
        int x = 2;
        add(loginLabel, cc.xy(x, 2));
        WebLabel passLabel = new WebLabel("Password: ");
        add(passLabel, cc.xy(x, 4));
        loginTextField = new WebTextField(35);
        x += 2;
        add(loginTextField, cc.xy(x, 2));
        passwordField = new WebPasswordField(35);
        add(passwordField, cc.xy(x, 4));

        JPanel buttonsPanel = new JPanel();
        signInButton = new WebButton("Sign in");
        buttonsPanel.add(signInButton);
        exitButton = new WebButton("Exit");
        buttonsPanel.add(exitButton);

        add(buttonsPanel, cc.xyw(2, 6, 3));
    }

    public WebTextField getLoginTextField() {
        return loginTextField;
    }

    public WebPasswordField getPasswordField() {
        return passwordField;
    }

    public WebButton getSignInButton() {
        return signInButton;
    }

    public WebButton getExitButton() {
        return exitButton;
    }
}
